 package com.kaluli.project.domain.entity;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import com.kaluli.system.domain.entity.DomainEntity;

@Entity
@Table(name = "kll_item")
public class KllProduct extends DomainEntity implements Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	@Column(name="title")
	private String title;
	@Column(name="pic")
	private String pic;
	@Column(name="brand_id")
	private Integer brandId;
	@Column(name="sell_point")
	private String sellPoint;
	@Column(name="intro")
	private String intro;
	@Column(name="price")
	private Double price;
	@Column(name="discount_price")
	private Double discountPrice;
	@Column(name="hits")
	private Integer hits;
	@Column(name="status")
	private Integer status;
	@Column(name="created_at")
	private Timestamp createdAt;
	@Column(name="updated_at")
	private Timestamp updatedAt;
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getPic() {
		return pic;
	}
	public void setPic(String pic) {
		this.pic = pic;
	}
	public Integer getBrandId() {
		return brandId;
	}
	public void setBrandId(Integer brandId) {
		this.brandId = brandId;
	}
	public String getSellPoint() {
		return sellPoint;
	}
	public void setSellPoint(String sellPoint) {
		this.sellPoint = sellPoint;
	}
	public String getIntro() {
		return intro;
	}
	public void setIntro(String intro) {
		this.intro = intro;
	}
	public Double getPrice() {
		return price;
	}
	public void setPrice(Double price) {
		this.price = price;
	}
	public Double getDiscountPrice() {
		return discountPrice;
	}
	public void setDiscountPrice(Double discountPrice) {
		this.discountPrice = discountPrice;
	}
	public Integer getHits() {
		return hits;
	}
	public void setHits(Integer hits) {
		this.hits = hits;
	}
	public Integer getStatus() {
		return status;
	}
	public void setStatus(Integer status) {
		this.status = status;
	}
	public Timestamp getCreatedAt() {
		return createdAt;
	}
	public void setCreatedAt(Timestamp createdAt) {
		this.createdAt = createdAt;
	}
	public Timestamp getUpdatedAt() {
		return updatedAt;
	}
	public void setUpdatedAt(Timestamp updatedAt) {
		this.updatedAt = updatedAt;
	}
	
//	@OneToMany(mappedBy = "id", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY,targetEntity=KllProductSku.class)
	@JoinColumn(name="item_id",referencedColumnName="id",insertable = false, updatable = false)
	public Set<KllProductSku> itemSkus = new HashSet<KllProductSku>();
	
	@OneToOne(cascade=CascadeType.ALL,fetch=FetchType.EAGER,targetEntity=KllProductAttr.class,optional=false)
	@JoinColumn(name="id",referencedColumnName="item_id",insertable = false, updatable = false)
	public KllProductAttr itemAttr;
	public Set<KllProductSku> getItemSkus() {
		return itemSkus;
	}
	public void setItemSkus(Set<KllProductSku> itemSkus) {
		this.itemSkus = itemSkus;
	}
	public KllProductAttr getItemAttr() {
		return itemAttr;
	}
	public void setItemAttr(KllProductAttr itemAttr) {
		this.itemAttr = itemAttr;
	}
	
	
	
	
	
	
	
	
}
